#ifndef __GND_MODULE_CONNECTION_H__
#define __GND_MODULE_CONNECTION_H__

#include <gtkmm/combobox.h>
#include <gtkmm/button.h>

#include "Module.h"


namespace Gnodroid {

    class ModuleConnection :
        public Module
    {
    public:
        ModuleConnection();

        void
        start();

        void
        stop();
    protected:

    private:

        //liststore里的列
        class DeviceColumns :
            public Gtk::TreeModel::ColumnRecord
        {
        public:
            DeviceColumns()
            {add(model);add(id);}
            Gtk::TreeModelColumn<Glib::ustring> model;
            Gtk::TreeModelColumn<Glib::ustring> id;
        };

        enum ConnectionStatus {
            STATUS_CONNECTED,
            STATUS_CONNECTING,
            STATUS_DISCONNECTED
        };

        //刷新设备列表
        void __refreshDeviceList();
        //初始化
        void __init();

        //按钮回调
        void __onRefresh();
        void __onConnect();

        //切换当前状态
        void __switchStatus(ConnectionStatus status);

        Gtk::ComboBox* m_pCbboxDeviceList;
        Gtk::Button* m_pBtnConnect;
        Gtk::Button* m_pBtnRefresh;

        DeviceColumns m_deviceColumns;

        //当前状态
        ConnectionStatus m_eConnectionStatus {STATUS_DISCONNECTED};


    };

}


#endif
